﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using DBTMDT.Dal;

namespace DBTMDT.Biz
{
    class BizGoiBid
    {
        public int IDGoiBid { get; set; }
        public string MaGoiBid { get; set; }
        public string TenGoiBid { get; set; }
        public decimal GiaThiTruong { get; set; }
        public Image HinhAnh { get; set; }
        public string MoTa { get; set; }
        public int SoLuongBid { get; set; }


        public BizGoiBid()
        {
            this.IDGoiBid = -1;

        }

        public BizGoiBid(int IDGoiBid, string MaGoiBid, string TenGoiBid, decimal GiaThiTruong, Image HinhAnh,
            string MoTa, int SoLuongBid
            )
        {
            this.IDGoiBid = IDGoiBid;
            this.MaGoiBid = MaGoiBid;
            this.TenGoiBid = TenGoiBid;
            this.GiaThiTruong = GiaThiTruong;
            this.HinhAnh = HinhAnh;
            this.MoTa = MoTa;
            this.SoLuongBid = SoLuongBid;
        }

        public BizGoiBid(string MaGoiBid, string TenGoiBid, decimal GiaThiTruong, Image HinhAnh,
        string MoTa, int SoLuongBid
        )
        {
         
            this.MaGoiBid = MaGoiBid;
            this.TenGoiBid = TenGoiBid;
            this.GiaThiTruong = GiaThiTruong;
            this.HinhAnh = HinhAnh;
            this.MoTa = MoTa;
            this.SoLuongBid = SoLuongBid;
        }

        public void Save()
        {
            if (this.IDGoiBid == -1)
                this.IDGoiBid = DalGoiBid.Insert(this);
            else
                DalGoiBid.Update(this);
        }
    }
}
